import request from '@/utils/request'

// 获取通知列表
export function getNotices() {
  return request({
    url: '/api/v1/home/notices/',
    method: 'get'
  })
}

// 获取通知详情
export function getNoticeDetail(id) {
  return request({
    url: `/api/v1/home/notices/${id}/`,
    method: 'get'
  })
}

// 创建通知
export function createNotice(data) {
  return request({
    url: '/api/v1/home/notices/',
    method: 'post',
    data
  })
}

// 更新通知
export function updateNotice(id, data) {
  return request({
    url: `/api/v1/home/notices/${id}/`,
    method: 'put',
    data
  })
}

// 删除通知
export function deleteNotice(id) {
  return request({
    url: `/api/v1/home/notices/${id}/`,
    method: 'delete'
  })
}

// 标记通知为已读
export function markNoticeAsRead(id) {
  return request({
    url: `/api/v1/home/notices/${id}/read/`,
    method: 'put'
  })
}

// 标记所有通知为已读
export function markAllNoticesAsRead() {
  return request({
    url: '/api/v1/home/notices/mark-all-read/',
    method: 'post'
  })
}

// 点赞通知
export function likeNotice(id) {
  return request({
    url: `/api/v1/home/notices/${id}/like/`,
    method: 'put'
  })
}

// 获取通知评论列表
export function getComments(noticeId) {
  return request({
    url: `/api/v1/home/notices/${noticeId}/comments/`,
    method: 'get'
  })
}

// 创建评论
export function createComment(noticeId, data) {
  return request({
    url: `/api/v1/home/notices/${noticeId}/comments/`,
    method: 'post',
    data
  })
}

// 更新评论
export function updateComment(noticeId, commentId, data) {
  return request({
    url: `/api/v1/home/notices/${noticeId}/comments/${commentId}/`,
    method: 'put',
    data
  })
}

// 删除评论
export function deleteComment(noticeId, commentId) {
  return request({
    url: `/api/v1/home/notices/${noticeId}/comments/${commentId}/`,
    method: 'delete'
  })
}

// 点赞评论
export function likeComment(noticeId, commentId) {
  return request({
    url: `/api/v1/home/notices/${noticeId}/comments/${commentId}/like/`,
    method: 'post'
  })
} 